package org.ands.input;

import java.util.ArrayList;
import java.util.List;

import javax.xml.namespace.NamespaceContext;

import org.ands.xml.DOMHelperCloneRoot;
import org.ands.xml.DOMHelperFromFile;
import org.w3c.dom.Element;

public abstract class InputHelperFactoryString implements IInputHelperFactory {


	public InputHelperFactoryString(List<String> stringList, NamespaceContext nsContext) throws Exception{
		init(stringList, nsContext);
	}
	
	public InputHelperFactoryString(List<String> stringList) throws Exception{
		init(stringList, null);
	}
	
	private void init(List<String> stringList, NamespaceContext nsContext) throws Exception{
		assert(stringList != null);
		if(stringList == null){
			throw new Exception("Requires populated object list");
		}
		
		_stringList = new ArrayList<String>();
		
		for(String value : stringList){
			assert(value != null);
			assert(!value.isEmpty());
			if((value != null) && (!value.isEmpty()))
				_stringList.add(value);
		}
		
		_nsContext = nsContext;
		
		_nextIndex = -1;
		
	}
	
	public boolean hasNextInputHelper(){
		return (++_nextIndex < _stringList.size());
	}
	
	List<String> _stringList;
	NamespaceContext _nsContext;
	int _nextIndex;
	
};
